package com.pig4cloud.pig.village.api.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.format.annotation.DateTimeFormat;

import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
 * 福利规则表
 * @author limbray.li
 * @date 2021/6/5
 */
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("config_welfare_rule")
public class WelfareRule extends Model<WelfareRule> {
	private static final long serialVersionUID = 1L;

	@TableId(value = "id", type = IdType.ASSIGN_ID)
	private Long id;
	@JsonIgnore
	private LocalDateTime createTime;
	@JsonIgnore
	private LocalDateTime updateTime;
	@JsonIgnore
	private String createBy;
	@JsonIgnore
	private String updateBy;
	@TableLogic(value = "0",delval = "1")
	@JsonIgnore
	private String delFlag;
	@JsonIgnore
	private Integer tenantId;

	@ApiModelProperty(value = "基金Id")
	private Long fundId;

	@ApiModelProperty(value = "福利Id")
	private Long welfareId;

	@ApiModelProperty(value = "1:发放/0:扣除")
	private Integer raise;

	@ApiModelProperty(value = "金额")
	private BigDecimal amount;

	@ApiModelProperty(value = "发放时间维度，0：月，1：年，2：次")
	//TODO 枚举？event表有类似字段！
	private Integer timeDimension;

	@ApiModelProperty(value = "0：人，1：户，2：队")
	//TODO 枚举？
	private Integer groupDimension;

	@ApiModelProperty(value = "发放条件维度1")
	private String conditionDimension1;
	@ApiModelProperty(value = "条件值1")
	private String extentDimension1;
	@ApiModelProperty(value = "发放条件维度2")
	private String conditionDimension2;
	@ApiModelProperty(value = "条件值2")
	private String extentDimension2;

	@ApiModelProperty(value = "发放年度")
	private Integer year;

	@ApiModelProperty(value = "生效时间-起")
	@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	private LocalDateTime beginTime;

	@ApiModelProperty(value = "生效时间-止")
	@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	private LocalDateTime endTime;

	@ApiModelProperty(value = "规则代码")
	private String rules;

	@ApiModelProperty(value = "备注")
	private String remark;
}
